﻿<#assign ctx=request.contextPath />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="${ctx}/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/h-ui/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/h-ui/css/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<title>后台登录</title>
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />

<div class="loginWraper">
  <div id="loginform" class="loginBox">
    <form class="form form-horizontal"  method="post">
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="userId" name="userId" type="text" placeholder="账户" class="input-text size-L" value="admin">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="password" name="password" type="password" placeholder="密码" class="input-text size-L" value="123456">
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input class="input-text size-L" id="vcode" name="vcode" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
          <img src="${ctx}/tocode" id="codeImg" style="width: 100px;height: 40px;"> <a id="kanbuq" href="javascript:;">看不清，换一张</a> </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="online">
            <input type="checkbox" name="online" id="online" value="">
            记住我</label>
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input id="btn"  type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
          <input  type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
        </div>
      </div>
    </form>
  </div>
</div>
<div class="footer">Copyright E购通电子商务平台后台管理系统</div>

<script type="text/javascript" src="${ctx}/static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="${ctx}/static/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript">
	
	$(function(){
		
		//点击图片，刷新验证码
		$("#codeImg").click(function(){
			$(this).attr("src","${ctx}/tocode?"+Math.random())
		})
		
		
		$("#btn").click(function(){
			
			//获取参数
			var userId = $("#userId");
			var pwd = $("#password");
			var vcode = $("#vcode");
			
			if(userId.val() ==""){
				alert("用户名不能为空!");
				userId.focus();
			}else if(pwd.val() ==""){
				alert("密码不能为空!");
				password.focus();
			}else if(vcode.val() == ""){
				alert("验证码不能为空");
				vcode.focus();
			}else{
				//发送ajax请求
				$.post("${ctx}/admin/Login",
						{"userId": userId.val(), 
					     "pwd": pwd.val(),"vcode":vcode.val()},
						 function(data){
						     if(data.status =="success"){
						    	 window.location = "${ctx}/admin/adminHome";
						     }else if(data.status == "fail"){
						    	 //刷新验证码
						    	 $("#codeImg").trigger("click");
						    	 alert(data.tip);
						     }else{
						    	 alert("网络错误!");
						     }
						   });
			}
		})
	})


</script>
</body>
</html>